package com.briup.estore.web.controller;

import com.briup.estore.Service.CollectService;
import com.briup.estore.vo.CollectVO;
import com.briup.estore.web.response.Result;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

@RestController
@Api(tags = "收藏")
@RequestMapping("/collect")
public class CollectController {
    @Autowired
    private CollectService collectService;

    @GetMapping("/")
    @ApiOperation("查看收藏")
    public Result getCollects(HttpServletRequest request){
        String userId=(String) request.getAttribute("userId");
        List<CollectVO> list = collectService.getCollects(Integer.parseInt(userId));
        System.out.println("list = " + list);
        return Result.success(list);
    }
}
